package com.mark.util;
/*
* @Author: Choisaaaa
* @Date: 2018/5/7  17:24
*/

import org.apache.commons.lang3.StringUtils;

import javax.servlet.http.HttpSession;

public class VerificationCodeUtil {
    public static boolean checkVerifyCode(String codeValue, HttpSession session){
        //验证码期望值
        String verifyCodeExpected = (String) session.getAttribute(com.google.code.kaptcha.Constants.KAPTCHA_SESSION_KEY);
        //验证码的实际输入值
        String verifyCodeActual = codeValue;
        if(StringUtils.isBlank(verifyCodeActual) || !StringUtils.endsWithIgnoreCase(verifyCodeExpected,verifyCodeActual)){
            return  false;
        }
        return true;
    }
}
